﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DomSharp
{
    public struct IntOrString
    {
        public bool IsString { get; private set; }
        public string String { get; private set; }
        public int Int { get; private set; }

        private IntOrString(string value) : this()
        {
            String = value;
            IsString = true;
        }

        private IntOrString(int value) : this()
        {
            Int = value;
            IsString = false;
        }

        public static implicit operator int(IntOrString x)
        {
            return x.Int;
        }

        public static implicit operator IntOrString(string x)
        {
            return new IntOrString(x);
        }

        public static implicit operator string(IntOrString x)
        {
            return x.String;
        }

        public static implicit operator IntOrString(int x)
        {
            return new IntOrString(x);
        }
    }
}
